<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>销售订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../style/index.css">
    <style>
        .custom-tree-node {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            padding-right: 8px;
        }

        .custom-tree-node .config {
            padding: 10px 0 10px 8px;
            /* border-left: 1px solid #EBEEF5; */
        }

        .el-tree-node__content {
            padding: 10px 0 10px;
            /* border-bottom: 1px solid #EBEEF5; */
        }

        .el-dialog__header {
            padding: 15px 15px 10px;
        }

        .el-dialog__body {
            padding: 15px;
        }

        .el-dialog__footer {
            padding: 5px 15px 10px;
        }

        .cont-scroll-wrap {
            border: 1px solid #EBEEF5;
            flex: auto;
            height: 0;
            overflow-y: auto;
        }

        .el-descriptions-item__label {
            width: 100px;
        }

        #show .el-input.is-disabled .el-input__inner {
            color: #000;
            background-color: #fff;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <el-tabs v-model="form.Row_Status" @tab-click="onSerach">
            <el-tab-pane label="全部" name=""></el-tab-pane>
            <el-tab-pane label="待付款" name="2"></el-tab-pane>
            <el-tab-pane label="待发货" name="3"></el-tab-pane>
            <el-tab-pane label="配送中" name="4"></el-tab-pane>
            <el-tab-pane label="已完成" name="5"></el-tab-pane>
            <el-tab-pane label="订单取消" name="6"></el-tab-pane>
            <el-tab-pane label="已退款" name="7"></el-tab-pane>
        </el-tabs>
        <el-form :inline="true" :form="form">
            <el-form-item>
                <el-input v-model.trim="form.Sales_Order_SerialNumber" clearable placeholder="请输入订单编号" />
            </el-form-item>
            <!-- <el-form-item>
                <el-select v-model.trim="form.Activity_SerialNumber" clearable style="width: 100%;"
                    placeholder="请选择活动列表">
                    <el-option v-for="item in Activity" :key="item.Activity_SerialNumber" :label="item.Activity_Name"
                        :value="item.Activity_SerialNumber"></el-option>
                </el-select>
            </el-form-item> -->
            <el-form-item>
                <el-input v-model.trim="form.Sales_Phone" clearable placeholder="收件人手机号" />
            </el-form-item>
            <el-form-item>
                <el-input v-model.trim="form.Member_SerialNumber" clearable placeholder="下单人手机号" />
            </el-form-item>
            <el-form-item>
                <el-input v-model.trim="form.Sales_Contacts" clearable placeholder="收件人" />
            </el-form-item>
            <el-form-item>
                <el-input v-model.trim="form.Member_Name" clearable placeholder="下单人" />
            </el-form-item>
            <el-form-item>
                <el-date-picker prefix-icon="el-icon-date" v-model="form.Sales_Date" clearable type="datetimerange"
                    value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']" format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
                    end-placeholder="结束日期"></el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSerach">查询</el-button>
            </el-form-item>
            <el-form-item>
                <yl-button type="success" :data="ExportData" :loading="loading" @click="Export(form)">销售订单导出</yl-button>
            </el-form-item>
        </el-form>
        <el-row :gutter="20">
            <el-col :span="isTree?4:0">
                <div :style="{height:'calc(100vh - 200px)'}" class="cont-scroll-wrap">
                    <el-tree highlight-current @node-click="handleNode" :data="treeData" node-key="Activity_SerialNumberAsAlias"
                        default-expand-all :expand-on-click-node="false" :props="defaultProps">
                        <span class="custom-tree-node" slot-scope="{ node, data }">
                            <span>
                                <i :class="node.level == 1 ? 'el-icon-user' : 'el-icon-star-off'"></i>
                                <span>{{ node.label }}</span>
                            </span>
                        </span>
                    </el-tree>
                </div>
            </el-col>
            <el-col style="position: relative;" :span="isTree?20:24">
                <div @click="showTree" style="cursor: pointer; text-align: center; color:#606266; font-size: 12px; border: 1px solid #EBEEF5; position: absolute; left: -11px; top: 0px; width: 15px;">
                    {{isTree?'隐藏树状图←':'显示树状图→'}} 
                </div>
                <el-table v-if="table" :data="tableData" stripe border height="calc(100vh - 200px)" style="width: 100%">
                    <el-table-column fixed="left" align="center" type="index" label="序号" width="50"></el-table-column>
                    <el-table-column fixed="left" align="center" width="80" label="操作">
                        <template v-slot="{row}">
                            <el-dropdown @command="Operate($event,row)" placement="bottom">
                                <span class="el-dropdown-link" style="cursor: pointer;">···</span>
                                <el-dropdown-menu slot="dropdown">
                                    <el-dropdown-item command="Show">订单详情</el-dropdown-item>
                                </el-dropdown-menu>
                            </el-dropdown>
                        </template>
                    </el-table-column>
                    <el-table-column fixed="left" align="center" prop="Sales_Order_SerialNumber" width="200" show-overflow-tooltip label="订单编号"></el-table-column>
                    <el-table-column align="center" prop="Activity_Name" width="200" show-overflow-tooltip label="所属活动">
                        <template v-slot="{row}">
                            <span>{{row.Activity_Name?row.Activity_Name:'非活动商品'}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" prop="Sales_Amount" show-overflow-tooltip width="180" label="订单消费">
                        <template v-slot="{row}">
                            <span>{{Amount(row)}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" prop="Member_Name" width="100" label="用户姓名"></el-table-column>
                    <el-table-column align="center" prop="Sales_Contacts" width="100" label="收件人"></el-table-column>
                    <el-table-column align="center" prop="Sales_Phone" width="120" label="联系方式"></el-table-column>
                    <el-table-column align="center" prop="Sales_Address" width="300" show-overflow-tooltip label="收货地址"></el-table-column>
                    <el-table-column align="center" prop="Sales_Date" width="170" label="下单时间"></el-table-column>
                    <el-table-column align="center" prop="Sales_Message" width="250" show-overflow-tooltip label="用户备注"></el-table-column>
                    <el-table-column align="center" width="170" label="平台备注" show-overflow-tooltip>
                        <template v-slot="{row}">
                            <div v-if="!row.is1">
                                <i @click="row.is1 = true" class="el-icon-edit" style="cursor: pointer;color: red;"></i> <span>{{row.Notes?row.Notes:'暂无备注'}}</span>
                            </div>
                            <div v-else>
                                <i @click="handleNotes(row)" class="el-icon-finished" style="cursor: pointer;color: red;"></i>
                                <el-input size="mini" style="width:110px" v-model="row.Notes" placeholder="请输入备注"></el-input>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" fixed="right" width="100" prop="Row_Status" label="订单状态">
                        <template v-slot="{row}">
                            <el-tag :type="Type(row)[1]">
                                {{Type(row)[0]}}
                            </el-tag>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination style="margin-top: 5px;" background @size-change="handleSizeChange"
                    @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[20, 30, 50]"
                    :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </el-col>
        </el-row>
        <show-detail :visible.sync="dialogVisible" :data="Sales_Order" @success="getList(form)"></show-detail>
    </div>
    <script type="text/javascript" src="../../../utils/wangeditor.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../utils/vuex.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../component/component.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.min.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.full.min.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.core.min.js"></script>
    <script type="text/javascript" src="../../../config/config.js"></script>
    <script type="text/javascript" src="../../../utils/compressor.js"></script>
    <script type="text/javascript" src="../../../utils/ID_Validity.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="../index.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

</html>